home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / B_TILES.DMO < prev    next >
Text File  |  1996-07-04  |  5KB  |  99 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   B_TILES .DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │ LIBRARY                  ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16.  For an exciting background, box filler, or a plythora of boxes this routine
  17.  just can't be beat! The demo shows how to create a block of 256 boxes with
  18.  one call! The whole grid could then be treated as one event box with a
  19.  quick computation as to which row/col the mouse "HIT" at and you have the
  20.  ASCII value of the box!
  21. $endif
  22.  
  23. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  24. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  25.                                                     '┌───────────────────────
  26. $INCLUDE "DAS-NB01.INC"                             '│
  27. $INCLUDE "DAS-NBV1.INC"                             '│
  28. $INCLUDE "DAS-NBV2.INC"                             '│
  29.                                                     '│
  30. CLS                                                 '│ get the VGA screen
  31. SCREEN 12                                           '│ set-up
  32. GraphicSETUP                                        '│
  33. fLoadDAScolor                                       '│ load 3D color system
  34.                                                     '│
  35. C? = 3                                              '│ print the HEX numbers
  36. FOR R? = 2 TO 17                                    '│ both horizontal
  37.   L$ = MID$( " 0123456789ABCDEF",R?, 1 )            '│ and vertical
  38.   LOCATE R?, 1 : PRINT L$                           '│
  39.   LOCATE 1, C? : PRINT L$                           '│
  40.   INCR C?, 2                                        '│
  41. NEXT                                                '│
  42. GBoxTILES 12, 15, 268, 271, 3, 8, 13, 16, 16        '│ draw 256 16x16 boxes
  43.                                                     '│
  44. DO                                                  '│ menu loop
  45.   LOCATE 18, 3 : PRINT "BOX: &h"; fHEX$( Box%, 1 )  '│ report on box #
  46.   X1% = ( ( Box% MOD 16 ) * 16 ) + 12               '│ compute X,Y coords
  47.   Y1% = ( ( Box%  \  16 ) * 16 ) + 15               '│
  48.   X2% = X1% + 15                                    '│
  49.   Y2% = Y1% + 15                                    '│
  50.   GBoxCOLOR2 X1%, Y1%, X2%, Y2%,  3,  4             '│ color hot box yellow
  51.   GBoxCOLOR2 X1%, Y1%, X2%, Y2%,  8,  9             '│
  52.   GBoxCOLOR2 X1%, Y1%, X2%, Y2%, 13, 14             '│
  53.   G$ = fANYkey$                                     '│ get a key
  54.   GBoxCOLOR2 X1%, Y1%, X2%, Y2%,  4,  3             '│ color hot box blue
  55.   GBoxCOLOR2 X1%, Y1%, X2%, Y2%,  9,  8             '│
  56.   GBoxCOLOR2 X1%, Y1%, X2%, Y2%, 14, 13             '│
  57.   SELECT CASE G$                                    '│ select key-action
  58.     CASE CHR$(27)                                   '│ <ESC> bail out
  59.       EXIT LOOP                                     '│
  60.     CASE CHR$(0,72)                                 '│ <UP>
  61.       IF Box% > 15 THEN DECR Box%, 16               '│
  62.     CASE CHR$(0,75)                                 '│ <LEFT>
  63.       IF ( Box% MOD 16 ) > 0 THEN DECR Box%, 1      '│
  64.     CASE CHR$(0,77)                                 '│ <RIGHT>
  65.       IF ( Box% MOD 16 ) < 15 THEN INCR Box%, 1     '│
  66.     CASE CHR$(0,80)                                 '│ <LEFT>
  67.       IF Box% < 240 THEN INCR Box%, 16              '│
  68.   END SELECT                                        '│
  69. LOOP                                                '│
  70.                                                     '│
  71.                                                     '│
  72. CLS : PALETTE : SCREEN 0 : END                      '│
  73.                                                     '└───────────────────────
  74.  
  75.  
  76. SUB GBoxTiles2( BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL Y2%, _
  77.                BYVAL BXa?, BYVAL TLa?, BYVAL BRa?, BYVAL Wide%, BYVAL High% ) LOCAL PUBLIC
  78.   LOCAL X%, Y%, Z%
  79.  
  80.   GBoxCOLOR X1%, Y1%, X2%, Y2%, BXa?
  81.  
  82.   FOR X% = X1% TO X2%-1 STEP Wide%
  83.     Z% = ( X%+1 )      : GLineDRAW Z%, Y1%, Z%, Y2%, 0, 3, TLa?
  84.     Z% = ( X%+Wide%-1) : GLineDRAW Z%, Y1%, Z%, Y2%, 0, 3, BRa?
  85.   NEXT
  86.  
  87.   FOR Y% = Y1% TO Y2%-1 STEP High%
  88.                          GLineDRAW X1%, Y%, X2%, Y%, 0, 3, 15
  89.     Z% = ( Y%+1 )      : GLineDRAW X1%, Z%, X2%, Z%, 0, 3, TLa?
  90.     Z% = ( Y%+High%-1) : GLineDRAW X1%, Z%, X2%, Z%, 0, 3, BRa?
  91.   NEXT
  92.  
  93.   FOR X% = X1% TO X2% STEP Wide%
  94.     GLineDRAW X%, Y1%, X%, Y2%, 0, 3, 15
  95.   NEXT
  96.   GLineDRAW X1%, Y2%, X2%, Y2%, 0, 3, 15
  97.  
  98. END SUB
  99.